package org.siam.impl.data.rendering {
	
	import flash.utils.Dictionary;
	
	import mx.core.ClassFactory;
	import mx.core.IFactory;
	
	import org.siam.core.data.rendering.IRendererRegistry;
	
	public class RendererRegistry implements IRendererRegistry {
		
		private static const DEFAULT:IFactory = null;
		
		private var _registry:Dictionary = new Dictionary();
		
		public function RendererRegistry() {
		}
		
		public function register(id:String, renderer:IFactory):void {
			_registry[id] = renderer;			
		}
		
		public function has(id:String):Boolean {
			return _registry.hasOwnProperty(id);
		}
		
		public function find(id:String):IFactory {
			return has(id) ? _registry[id] : DEFAULT;
		}
	}
}